package ch.zbw.pra.sysventory.presentation.handler;

import java.util.Observable;

import ch.zbw.pra.sysventory.application.controller.ScanController;
import ch.zbw.pra.sysventory.model.Scanversion;
import ch.zbw.pra.sysventory.presentation.panels.ApplicationPanel;

/**
 * ScanHandler
 * 
 * @author Ralph Koster
 */

public class ScanHandler extends Observable implements Runnable {

	private ScanController scanController;
	
	public ScanHandler(ApplicationPanel applicationPanel, ScanController scanController) {
		this.scanController = scanController;
		this.addObserver(applicationPanel);
	}
	
	@Override
	public void run() {
		Scanversion scanversion = scanController.doScan();
		setChanged();
        notifyObservers(scanversion);
	}

	public void stopScan() {
		scanController.cancelScan();
	}
}
